package com.ysd.lis.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ysd.common.Result;
import com.ysd.lis.entity.SysModuleLog;
import com.ysd.lis.mapper.sys.SysModuleLogMapper;
import com.ysd.lis.service.SysModuleLogService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * cold_chain.sys_module 服务实现类
 * </p>
 *
 * @author Bai
 * @since 2023-10-18
 */
@Service
public class SysModuleLogServiceImpl extends ServiceImpl<SysModuleLogMapper, SysModuleLog> implements SysModuleLogService {

    @Autowired
    SysModuleLogService sysModuleLogService;
    @Override
    public Result findSysModuleLogList(String state) {
        LambdaQueryWrapper<SysModuleLog> wrapper = new LambdaQueryWrapper<SysModuleLog>();
        if (StringUtils.isNotBlank(state)){
            wrapper.eq(SysModuleLog::getState, state);
        }
        wrapper.orderByDesc(SysModuleLog::getCreateTime)
                .eq(SysModuleLog::getDelFlag, "0");
        List<SysModuleLog> list = sysModuleLogService.list(wrapper);

        return Result.succ(1, "查询成功", list);    }
}
